package com.nebrija.riif.model.functions;

import com.nebrija.riif.model.Function;
import com.nebrija.riif.model.Util;
import com.nebrija.riif.model.ValueTimeUnit;

public class ExpressTimeFunction  extends Function{
	
	public static final String NAME = "express_time";
	
	
	public ExpressTimeFunction() {
		super(ExpressTimeFunction.NAME,2);
	}

	@Override
	protected Object executeFunction(Object... operands) {
		double value = Util.convertToDouble(operands[1]);
		String unit = ((String)operands[0]).replaceAll("\"", "");
		ValueTimeUnit vtu = new ValueTimeUnit(value, unit);
		return vtu;
	}
}
